<div class="comments index">
	
	<h2>
		<?php echo $this->Html->image("/admin/images/icons/icon_comments.png"); ?>
		<?php echo __('Comments'); ?>
	</h2>
	
	<?php echo $this->Html->link(__('Add'), array('action' => 'add'), array('class' => 'button add')); ?>
	
	<table cellpadding="0" cellspacing="0">
		<?php if( !$comments ): ?>
		<tr>
			<td><?php echo __("No comments found."); ?></td>
		</tr>
		<?php else: ?>
		<tr>
				<th><?php echo $this->Paginator->sort('id');?></th>
				<th><?php echo $this->Paginator->sort('spot_id');?></th>
				<th><?php echo $this->Paginator->sort('user_id');?></th>
				<th><?php echo $this->Paginator->sort('comment');?></th>
				<th><?php echo $this->Paginator->sort('created');?></th>
				<th><?php echo $this->Paginator->sort('status');?></th>
				<th class="actions"><?php echo __('Actions');?></th>
		</tr>
		<?php foreach ($comments as $comment): ?>
		<tr>
			<td><?php echo h($comment['Comment']['id']); ?>&nbsp;</td>
			<td>
				<?php echo $this->Html->link($comment['Spot']['name'], array('controller' => 'spots', 'action' => 'view', $comment['Spot']['id'])); ?>
			</td>
			<td>
				<?php echo $this->Html->link($comment['User']['name'], array('controller' => 'users', 'action' => 'view', $comment['User']['id'])); ?>
			</td>
			<td><?php echo h($comment['Comment']['comment']); ?>&nbsp;</td>
			<td><?php echo h($comment['Comment']['created']); ?>&nbsp;</td>
			<td><?php echo h($comment['Comment']['status']); ?>&nbsp;</td>
			<td class="actions">
				<?php
				// view
				echo $this->Html->link(
					__('View'),
					array('action' => 'view', $comment['Comment']['id']),
					array('escape' => false, 'class' => 'button view')
				);
				// edit
				echo $this->Html->link(
					__('Edit'),
					array('action' => 'edit', $comment['Comment']['id']),
					array('escape' => false, 'class' => 'button edit')
				);
				// delete
				echo $this->Html->link(
					__('Delete'),
					array('action' => 'delete', $comment['Comment']['id']),
					array('escape' => false, 'class' => 'button delete'),
					__("Are you sure you want to delete this comment?")
				);
			?>
			</td>
				</tr>
		<?php endforeach; ?>
		<?php endif; ?>
	</table>
	
	<?php if($comments): ?>
	<!-- PAGINATION -->
	<div class="pagination">
		<p>
		<?php
		echo $this->Paginator->counter(array(
		'format' => __('Page {:page} of {:pages}')
		));
		?>		</p>
		<div class="paging">
		<?php
			echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
			echo $this->Paginator->numbers(array('separator' => ''));
			echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));
	?>
		</div>
	</div>
	<?php endif; ?>
	
</div>
